package cn.test.controller;

import java.util.Enumeration;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Han
 */
@Controller
public class SimpleController {
	
	@RequestMapping(value="/hello",method = {RequestMethod.POST,RequestMethod.GET})
	@ResponseBody
	public void hello(HttpServletRequest request){
		System.out.println(123);
		Enumeration<String> names = request.getParameterNames();
		while(names.hasMoreElements()){
			String tmp = names.nextElement();
			System.out.println(tmp+"--------"+request.getParameter(tmp));
		}
	}
	
	@RequestMapping(value="/hello2",method = {RequestMethod.POST,RequestMethod.GET})
	@ResponseBody
	public void hello(@RequestParam("id")List<Integer> ids){
		System.out.println(ids);
	}
	
}
